package cc.fozone.note.help;

import javafx.collections.ObservableList;
import javafx.scene.Node;
import javafx.scene.control.ScrollBar;
import javafx.scene.layout.StackPane;

public class ScrollPaneHelper {
	public static double getBlankValue (ScrollBar bar) {
		double trackValue = -1, thumbValue = -1;

		ObservableList<Node> barList = bar.getChildrenUnmodifiable();
		for(Node barNode : barList){
			if(barNode instanceof StackPane) {
				ObservableList<String> styleClasses = barNode.getStyleClass();
				if(styleClasses.contains("track")) {
					trackValue = ((StackPane) barNode).getHeight();
				} else if(styleClasses.contains("thumb")){
					thumbValue = ((StackPane) barNode).getHeight();
				}
			}
		}
		
		return trackValue - thumbValue;
	}
}
